package com.robot.member.client;

import com.robot.member.client.impl.OrdersClientImpl;
import com.robot.member.pojo.client.Orders;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * @author lin
 */
@Component
@FeignClient(value = "robot-orders", fallback = OrdersClientImpl.class)
public interface OrdersClient {
    /**
     * 通过会员Id和订单状态来获取订单分页数据
     * @param req 搜索条件
     * @param page 第几页
     * @param size 每页多少条数据
     * @return 分页数据
     */
    @RequestMapping(value = "orders/third/thirdFindOrders/{page}/{size}",method = RequestMethod.POST)
    String thirdFindOrders(@RequestBody HashMap<String,String>req,@PathVariable int page, @PathVariable int size);

    /**
     * 通过订单id获取订单
     * @param ordersId 订单id
     * @return 订单对象
     */
    @RequestMapping(value = "orders/third/thirdFindOrderByOrdersId/{ordersId}",method = RequestMethod.GET)
    String thirdFindOrderByOrdersId(@PathVariable String ordersId);

    /**
     * 更新订单
     * @param orders
     * @return
     */
    @RequestMapping(value="orders/third/thirdUpdateOrders",method = RequestMethod.PUT)
    void thirdUpdateOrders(@RequestBody Orders orders);

    /**
     * 删除订单
     * @param ordersId
     */
    @RequestMapping(value="orders/third/{ordersId}/{isSoftDelete}",method = RequestMethod.DELETE)
    void thirdDelete(@PathVariable String ordersId,@PathVariable boolean isSoftDelete);

    @RequestMapping(value = "orders/third/countAllStatusOrders/{memberId}",method = RequestMethod.GET )
    HashMap<String,Integer>countAllStatusOrders(@PathVariable String memberId);
}
